﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using Touch2Like.DAL;
using Touch2Like.Model;

namespace Touch2Like.Web.api
{
    public partial class subscribe : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request["subscribe[name]"]))
            {
                Database db = new Database();
                string sqlQuery = "Insert into Subscriber (subscriber, Createdate) values ('" + Request["subscribe[name]"] + "', GetDate())";
                db.ExecuteNonReturnQuery(sqlQuery);
                db.Close();

                //FileStream fs = new FileStream(Server.MapPath("log.txt"), FileMode.Append);
                //StreamWriter sw = new StreamWriter(fs);
                //sw.WriteLine(DateTime.Now.ToString() + " " + Request["subscribe[mail]"]);
                //sw.Flush();
                //sw.Close();
                //fs.Close();
            }
        }
    }
}